<?php
/**
 * Created by WuYe.
 * User: '常志明'
 * Date: 2018-11-07 18:26
 *
 * 消息通知
 */

namespace app\index\controller;


class Message
{
    const new_message = [
        'userId'=>'',
        'messageType'=>'',
        'state'=>'未查看',
    ];

    public static function getData($where, $one = true, $table = 'new_message')
    {
        return ($one == true) ? getFirst(mongo($table)->where($where)->select()) : mongo($table)->where($where)->select();
    }
    public static function setData($where, $data, $table = 'new_message')
    {
        mongo($table)->where($where)->update($data);
    }
    public static function insertData($data, $table = 'new_message')
    {
        mongo($table)->insert($data);
        return mongo($table)->getLastInsID();
    }
    public static function deleteData($where, $table = 'new_message')
    {
        mongo($table)->where($where)->delete();
    }
    /**
     * 获取新消息
     * @param string $messageType
     */
    public static function getNewMessage($messageType = '')
    {

    }

    /**
     * 作业单消息
     */
    private static function jobCardMessage()
    {

    }

    /**
     * 故障报修消息
     */
    private static function malfunctionMessage()
    {

    }
}